﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MBBHotelReservation
{
    public partial class frmPaymentDetails : Form
    {
        //Attributes
        string[] strdetails = new string[3];
        float amount = 0f;
        DateTime[] dateDetails = new DateTime[2];

        //Constructor
        public frmPaymentDetails()
        {
            InitializeComponent();
            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;

            DoEvents();
        }
        void DoEvents()
        {
            /*
            chkBank.CheckedChanged += new EventHandler(delegate
            {
                txtBank.Enabled = chkBank.Checked;
            });
            chkAccountName.CheckedChanged += new EventHandler(delegate
            {
                txtAccountName.Enabled = chkAccountName.Checked;
            });
            chkAccountNum.CheckedChanged += new EventHandler(delegate
            {
                txtAccountNum.Enabled = chkAccountNum.Checked;
            });
            chkAmount.CheckedChanged += new EventHandler(delegate
            {
                txtAmount.Enabled = chkAmount.Checked;
            });
            chkIssueDate.CheckedChanged += new EventHandler(delegate
            {
                txtIssueDate.Enabled = chkIssueDate.Checked;
                chkDueDate.Enabled = chkIssueDate.Checked;
                chkDueDate.Checked = false;
            });
            chkDueDate.CheckedChanged += new EventHandler(delegate
            {
                txtDueDate.Enabled = chkDueDate.Checked;
            });
            */
            btnOk.Click += new EventHandler(delegate
            {
                /*if (chkBank.Checked) strdetails[0] = txtBank.Text; else strdetails[0] = "";
                if (chkAccountName.Checked) strdetails[1] = txtAccountName.Text; else strdetails[1] = "";
                if (chkAccountNum.Checked) strdetails[2] = txtAccountNum.Text; else strdetails[2] = "";
                if (chkAmount.Checked) amount = (float)txtAmount.Value; else amount = -1f;
                if (chkIssueDate.Checked) dateDetails[0] = txtIssueDate.Value; else dateDetails[0] = DateTime.Parse("01/01/1200");
                if (chkDueDate.Checked) dateDetails[1] = txtDueDate.Value; else dateDetails[1] = DateTime.Parse("01/01/1200");
                */
                strdetails[0] = "";
                strdetails[1] = "";
                strdetails[2] = "";
                amount = -1f;
                dateDetails[0] = DateTime.Parse("01/01/1200");
                dateDetails[1] = DateTime.Parse("01/01/1200");

                strdetails[0] = txtBank.Text; 
                strdetails[1] = txtAccountName.Text;  
                strdetails[2] = txtAccountNum.Text;  
                amount = (float)txtAmount.Value;  
                dateDetails[0] = txtIssueDate.Value;  
                dateDetails[1] = txtDueDate.Value; 
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            });
        }

        public string[] TextDetails
        {
            get { return strdetails; }
        }
        public float Amount
        {
            get { return amount; }
        }
        public DateTime[] DateDetails
        {
            get { return dateDetails; }
        }
    }
}
